package org.bigdata.framework.core.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Select;
import org.bigdata.framework.core.model.OnlineQuestion;
import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;

/**
 * <p>
 * Mapper接口
 * </p>
 *
 * @author dal.liweiqiang
 * @since 2019-11-19
 */
public interface OnlineQuestionMapper extends BaseMapper<OnlineQuestion> {
	@Select("SELECT c.id,q.id AS questionId,q.`name`,q.type,q.answer_0 AS answer0,q.answer_1 AS answer1,q.answer_2 AS answer2,q.status,q.options,q.analysis"
			+ " FROM online_question c LEFT JOIN question q ON c.question_id = q.id where status='2' AND c.paper_id=#{id} ORDER BY c.id desc")
	List<Map<String, Object>> getOnlineQuestionList(Page<Map<String,Object>> page,String id);
	@Select("SELECT count(*) FROM online_question c LEFT JOIN question q ON c.question_id = q.id where status='2' AND c.paper_id=#{id}")
	Integer getOnlineQuestionListCount(String id);
}